﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace phhui
{
    class FileMgr
    {
        static public bool createDirectoryByYY(string fatherDir)
        {
            if(!Directory.Exists(fatherDir))throw new Exception("父目录不存在！");
            Directory.CreateDirectory(fatherDir+DateTime.Now.ToString("yyyy"));
            return true;
        }
        static public bool createDirectoryByYYYYMM(string fatherDir)
        {
            if (!Directory.Exists(fatherDir)) throw new Exception("父目录不存在！");
            Directory.CreateDirectory(fatherDir+"/" + DateTime.Now.ToString("yyyy"));
            Directory.CreateDirectory(fatherDir+"/" + DateTime.Now.ToString("yyyy")+"/"+ DateTime.Now.ToString("MM"));
            return true;
        }
        static public bool createDirectoryByYYYYMMDD(string fatherDir)
        {
            if (!Directory.Exists(fatherDir)) throw new Exception("父目录不存在！");
            Directory.CreateDirectory(fatherDir + "/" + DateTime.Now.ToString("yyyy"));
            Directory.CreateDirectory(fatherDir + "/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM"));
            Directory.CreateDirectory(fatherDir + "/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MM") + "/" + DateTime.Now.ToString("dd"));
            return true;
        }
    }
}
